class Solution(object):
    def reverseWords(self, s):
        """
        :type s: str
        :rtype: str
        """
        s_list = s.strip().split()
        return ' '.join(s_list[::-1])
if __name__ == '__main__':
    s = "the sky is blue"
    print(Solution().reverseWords(s))